<!-- 我的记录 -->

<template>
  <div v-if="hasRecord" class="MyRecord">
    <div class="MyRecord-title">
      <span><img src="@screen/assets/img/Monitor/title.png" />通行记录</span>
      <BtnText title="更多..." @click="openInfo" />
    </div>

    <div class="MyRecord-list">
      <div v-for="item in list" :key="item.id">
        <el-image :src="item.img" :preview-src-list="[item.img]" fit="cover" />

        <div class="MyRecord-list-data">
          <div>{{ item.name }}</div>
          <div v-if="item.mobile">{{ item.mobile }}</div>
          <div>{{ item.time.slice(5, 16) }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyRecord',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixScreen(), CORE.mixList()],

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 是否有记录
     */
    hasRecord() {
      const { infoType } = this
      return ['door', 'park'].includes(infoType)
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
